<?php
	/*
		AJAX Dispatcher
	*/
	
	require_once 'dbconfig.php';
	require_once 'Zend/Json.php';

	if (!isset($_POST['mod']))
		exit();

	// Send JSON header
	header('Content-Type: application/json');
	
	// Some stupid hosts have magic_quotes_gpc turned on with no way to turn them off
	if (get_magic_quotes_gpc()) {
		foreach ($_POST as $key => $value)
			$_POST[$key] = stripslashes($value);
	}

	$logger->log('AJAX dispatcher called with payload: ' . print_r($_POST, true), Zend_Log::DEBUG);

	require "./modules/" . $_POST['mod'] . "/ajax.php";
?>